import request from '@/config/axios'

export interface CouponCodeVO {
  id: number
  label: string
  code: string
  codeStatus: byte
  getTime: Date
  writeOffTime: Date
  batchCreatCount: number
}

// 查询券码列表
export const getCouponCodePage = async (params) => {
  return await request.get({ url: `/bank/coupon-code/page`, params })
}

// 查询券码详情
export const getCouponCode = async (id: number) => {
  return await request.get({ url: `/bank/coupon-code/get?id=` + id })
}

// 新增券码
export const createCouponCode = async (data: CouponCodeVO) => {
  return await request.post({ url: `/bank/coupon-code/create`, data })
}

// 批量新增券码
export const batchCreateCouponCode = async (data: CouponCodeVO) => {
  return await request.post({ url: `/bank/coupon-code/batch-create`, data })
}

// 修改券码
export const updateCouponCode = async (data: CouponCodeVO) => {
  return await request.put({ url: `/bank/coupon-code/update`, data })
}

// 删除券码
export const deleteCouponCode = async (id: number) => {
  return await request.delete({ url: `/bank/coupon-code/delete?id=` + id })
}

// 导出券码 Excel
export const exportCouponCode = async (params) => {
  return await request.download({ url: `/bank/coupon-code/export-excel`, params })
}
